<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <style>
        * {
            padding: 0;
            margin: 0;
        }
        .jd_banner{
            width: 300px;
            overflow: hidden;
            /* 默认不可见 为了用户体验*/
            visibility: hidden;
            position: relative;
        }
        .jd_bannerImg {
            overflow: hidden;
            position: relative;
        }
        .jd_bannerImg > li {
            float: left;
            position: relative;
        }
        .jd_bannerImg > li img {   
            width: 100%;
            display: block;
      
        }
        span {
            display: block;
            width: 18px;
            height: 26px;
            background-color: rgba(0, 0, 0, .2);
            color: white;
            position: absolute;
            top:50%;
            transform:translateY(-50%);
            text-align: center;
            line-height: 26px;
        }
        .pre {
            left: 10px;
        }
        .next {
            right: 10px;
        }
    </style>
    <script src="./js/swipe.js"></script>
</head>
<body>
    <div class="jd_banner clearfix">
        <!-- 图片 -->
        <ul class="jd_bannerImg">
            <li>
                <a href="javascript:;">
                    <img class="broadcast_first" src="./img/broadcast_picture1.jpg">
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img class="broadcast_second" src="./img/broadcast_picture2.jpg">
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img class="broadcast_third" src="./img/broadcast_picture3.jpg">
                </a>
            </li>
        </ul> 
        <span class="pre"><</span>
        <span class="next">></span>
    </div>
 
    <script>
        window.mySwipe = Swipe(document.querySelector('.jd_banner'),{
            auto:2000
        });
        window.onload = function(){
            document.querySelector(".pre").addEventListener("click",function(){
                // Swipe.js对对象的方法
                window.mySwipe.prev();     
            });
            document.querySelector(".next").addEventListener("click",function(){
                // Swipe.js对对象的方法
                window.mySwipe.next();     
            });
        }
    </script>
</body>
</html>